~ chicken-core (master) /manual/Egg specification format
Trap1[[tags: manual]]
2[[toc:]]
3
4
5== Format of the egg description file
6
7An egg description is basically an association list holding
8information about the components of the egg. An egg may contain
9multiple components: libraries, programs, Scheme or C include files
10and arbitrary data files. Dependencies between eggs can be
11specified as can be dependencies between components of an egg.
12
13A list of valid properties follows.
14
15=== Global properties
16
17==== version
18
19 [egg property] (version STRING)
20
21Specifies version string for this egg. {{STRING}} should have
22the format {{<MAJOR>.<MINOR>.<PATCHLEVEL>}}, where only the
23{{<MAJOR>}} part is mandatory.
24
25Eggs from remote egg servers are automatically versioned - the
26version is part of the protocol to retrieve the egg and does not
27have to be specified in the {{.egg}} file. Eggs installed from
28local directories (see below) should explicitly specify a version.
29
30==== synopsis
31
32 [egg property] (synopsis STRING)
33
34Gives a short description of this egg.
35
36==== author
37
38 [egg property] (author STRING)
39
40Names the author or authors of the contained code.
41
42==== maintainer
43
44 [egg property] (maintainer STRING)
45
46Names the maintainer of this code, if different from author(s).
47
48==== category
49
50 [egg property] (category NAME)
51
52Gives the category under which this egg should be contained.
53See [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|the egg index]]
54for a list of currently used categories.
55
56==== license
57
58 [egg property] (license STRING)
59
60Names the license under which this code is available.
61
62==== dependencies
63
64 [egg property] (dependencies EGG ...)
65
66Lists eggs that this egg depends on, and which should be
67built and installed if they do not already exist in the repository.
68{{EGG}} should be whether a symbol or a list of the form
69{{EGGNAME VERSION}}, where the former means to install the
70newest available egg with this name and the latter specifies
71a specific version or higher. {{EGGNAME}} may also be the string or
72symbol {{chicken}}, in case you want your extension to depend
73on a minimum required CHICKEN of {{VERSION}} or newer.
74
75This property can also be used to specify a minimum version of CHICKEN
76required by the egg. For example, to require at least CHICKEN 5.3.0:
77
78<enscript highlight=scheme>
79(dependencies (chicken "5.3.0"))
80</enscript>
81
82==== test-dependencies
83
84 [egg property] (test-dependencies EGG ...)
85
86Lists eggs that are required for this egg to run the tests
87(if tests exist.) This only has an effect if the {{-test}}
88option has been given to {{chicken-install}}.
89
90==== build-dependencies
91
92 [egg property] (build-dependencies EGG ...)
93
94Lists eggs that are build-time dependencies for this egg,
95i.e. there are required to build, but not to run the contained
96code. Currently this is treated identical to {{dependencies}}.
97
98==== foreign-dependencies
99
100 [egg property] (foreign-dependencies NAME ...)
101
102Lists external dependencies like native code libraries
103or system-specific packages and is currently only used for
104documentation purposes.
105
106==== platform
107
108 [egg property] (platform PLATFORM)
109
110Specifies for which platform this egg is intended. {{PLATFORM}}
111should be a symbol naming the target platform ({{windows}}, {{linux}}
112or {{unix}}) or a boolean combination of platform values, allowed
113are {{(not PLATFORM)}}, {{(or PLATFORM ...)}} and {{(and PLATFORM ...)}}.
114If the expression can not be satisfied, then installation of this
115egg will abort.
116
117==== distribution-files
118
119 [egg property] (distribution-files FILE ...)
120
121List of files required for the installation of the egg. This
122form is not handled by chicken-install, but by henrietta-cache to
123determine what to cache. If the repository contains additional
124files that are unneeded for the egg to be installed, you can list
125all the required files in this clause to reduce the amount of data
126cached by egg servers.
127
128==== components
129
130 [egg property] (components COMPONENT ...)
131
132Lists components (extensions, programs, include- or data files) that
133this extension installs. See [[#component-types|Component types]] and
134[[#component-properties|component properties]] for information on how
135to specify component-specific information.
136
137==== host
138
139 [egg property] (host PROP ...)
140
141Recursively process {{PROP ...}}, but only for the host (build)
142platform, in case this is a "cross-chicken", a CHICKEN installation
143intended for cross compilation.
144
145==== target
146
147 [egg property] (target PROP ...)
148
149Recursively process {{PROP ...}}, but only for the target
150platform, in case this is a "cross-chicken", a CHICKEN installation
151intended for cross compilation.
152
153==== component-options
154
155 [egg property] (component-options OPTIONSPEC ...)
156
157Specifies global options for all programs and extensions compiled for this egg.
158{{OPTIONSPEC}} may be {{csc-options}}, {{link-options}} or {{linkage}} specifications.
159
160==== cond-expand
161
162 [egg property] (cond-expand CLAUSE ...)
163
164Conditionally expand egg specification forms, depending on system
165features. Each {{CLAUSE}} should be of the form
166{{(TEST PROPERTY)}} where {{TEST}} is a feature identifier or a
167conditional form, in the same syntax as used in the {{cond-expand}}
168syntactic form.
169
170In addition to normal system-wide feature identifiers, feature identifiers
171given via the {{-feature}} option to {{chicken-install}} are visible in
172the tests. Also, the features {{target}}, {{host}}, {{dynamic}} and
173{{static}} are visible, depending on surrounding egg specification
174forms for constraining mode and linkage.
175
176==== error
177
178 [egg property] (error STRING ARG ...)
179
180Signal an error and abort processing. Mostly useful inside {{cond-expand}} forms.
181
182=== Component types
183
184==== extension
185
186 [egg property] (extension NAME PROP ...)
187
188Specifies an extension library component. The properties
189{{PROP...}} are processed recursively and apply only to this
190component.
191
192==== data
193
194 [egg property] (data NAME PROP ...)
195
196Specifies one or more arbitrary data files.
197
198==== generated-source-file
199
200 [egg property] (generated-source-file NAME PROP ...)
201
202Specifies a file that is generated during the process of building
203the egg.
204
205==== c-include
206
207 [egg property] (c-include NAME PROP ...)
208
209Specifies one or more C include files.
210
211==== scheme-include
212
213 [egg property] (scheme-include NAME PROP ...)
214
215Specifies one or more Scheme include files.
216
217==== program
218
219 [egg property] (program NAME PROP ...)
220
221Specifies an executable program.
222
223==== c-object
224
225 [egg property] (c-object NAME PROP ...)
226
227Specifies a compiled C/C++ object file. Usually this component type
228is required if you want to link a separately compiled C/C++ module
229with your extension or program. C-objects are compiled like Scheme
230source files with the {{csc}} tool to ensure the same C compiler
231options and toolchain is used as for regular Scheme files compiled
232to C. If you want to pass compiler-specific options to the build
233of the C object, use the {{csc-options}} property and precede
234C compiler options with {{-C}}.
235
236Components of this type are never installed, they just exist at build time.
237
238==== installed-c-object
239
240 [egg property] (installed-c-object NAME PROP ...)
241
242Similar to {{c-object}}, but the compiled object file will be installed in the
243extension repository.
244
245=== Component properties
246
247==== host
248
249 [egg property] (host PROP ...)
250
251Process {{PROP ...}} recursively for the current component, but
252apply the properties only to the host (build) part, when using
253a CHICKEN installation intended for cross-compilation.
254
255==== target
256
257 [egg property] (target PROP ...)
258
259Process {{PROP ...}} recursively for the current component, but
260apply the properties only to the target part, when using
261a CHICKEN installation intended for cross-compilation.
262
263==== linkage
264
265 [egg property] (linkage LINKAGE)
266
267Define whether the component should be linked dynamically or
268statically. {{LINKAGE}} can be {{static}} or {{dynamic}}. This
269property only makes sense for extension libraries.
270
271==== types-file
272
273 [egg property] (types-file [NAME])
274
275Specifies that a "type-database" file should be generated and
276installed for this component. This property is only used for
277extension libraries. The name is optional and defaults to the
278name of the extensions (with the proper extension).
279
280If {{NAME}} is a list of the form {{(predefined [NAME])}}, then
281no types file is created during compilation and an existing types file
282for this extension is assumed and installed.
283
284==== inline-file
285
286 [egg property] (inline-file [NAME])
287
288Specifies that an "inline" file should be generated and installed
289for this component. This property is only used for extension
290libraries. The name is optional and defaults to the
291name of the extensions (with the proper extension).
292
293==== custom-build
294
295 [egg property] (custom-build STRING)
296
297Specifies a custom build script that should be executed instead of
298the default build operations. This property is mandatory for
299components of type {{generated-source-file}}. {{STRING}} should be the
300name of a {{sh(1)}} shell command (e.g., a script) and thus may be platform
301sensitive. The path to the file is prepended implicitly, so you
302should '''not''' prefix it with {{./}}.
303
304The script will be invoked like the {{csc}} program and
305is executed with the location of the CHICKEN
306binaries in the {{PATH}}. Also, the following environment variables
307are set in the execution environment of the script:
308
309* {{CHICKEN_CC}}: name of the C compiler used for building CHICKEN
310* {{CHICKEN_CXX}}: name of the C++ compiler set during the build of CHICKEN
311* {{CHICKEN_CSC}}: path to {{csc}}
312* {{CHICKEN_CSI}}: path to {{csi}}
313
314
315==== csc-options
316
317 [egg property] (csc-options OPTION ...)
318
319Specifies additional compiler options for {{csc}} that should be
320used when building this component. If this property is not
321given, the default options are used, which are {{-O2 -d1}}
322for extensions and programs and {{-O2 -d0}} for import
323libraries.
324
325Note that the options are quoted when passed to csc during the
326compilation of the extension, so multiple options should be specified
327as {{(csc-options "OPT1" "OPT2" ...)}} instead of {{(csc-options "OPT1 OPT2")}}
328(the latter would be a single option containing a whitespace character).
329
330OPTION may optionally be a list of the form {{(custom-config FILENAME ARG ...)}},
331which allows to dynamically determine options to be passed to the {{csc}}
332program. FILENAME should be the name of a Scheme source file in the
333current build directory. The file is invoked as {{csc -s FILENAME ARG ...}}
334and should write s-expressions to stdout that are taken as additional
335options to be passed to {{csc}} when compiling a component. The expressions
336are read in, any list structure is flattened and all items are converted to
337strings and added to the list of compilation options.
338
339==== link-options
340
341 [egg property] (link-options OPTION ...)
342
343Specifies additional link options for {{csc}} that should be
344used when building this component.
345
346Note that the options are quoted when passed to csc during the
347compilation of the extension, so multiple options should be specified
348as {{(link-options "OPT1" "OPT2" ...)}} instead of {{(link-options "OPT1 OPT2")}}
349(the latter would be a single option containing a whitespace character).
350
351Note that in order to pass linker options to the underlying C-compiler, these must
352be prefixed with {{-L}}, eg. {{(link-options "-L" "-lpng")}}.
353
354This property supports {{custom-config}} specifications, described above.
355
356==== source
357
358 [egg property] (source NAME)
359
360Specifies an alternative source file, in case it has a name
361distinct from the component name. By default the source file
362for a component is named after the component, with the {{.scm}}
363extension added.
364
365==== install-name
366
367 [egg property] (install-name NAME)
368
369Specifies an alternative installation name of the component,
370if it differs from the actual component name. This property
371is most useful if an egg installs an extension and a program
372of the same name, but needs to distinguish the components during
373build time.
374
375==== component-dependencies
376
377 [egg property] (component-dependencies NAME ...)
378
379Specifies dependencies to other components. {{NAME ...}} must
380be the names of extension, program, scheme-include- or generated source file
381components that should be built before the current component.
382
383==== source-dependencies
384
385 [egg property] (source-dependencies NAME ...)
386
387Specifies dependencies to additional source files. {{NAME ...}} must
388denote filenames of which the program or extension depends.
389A program or extension implicitly depends on its source file and
390and on the egg-specification file.
391
392==== objects
393
394 [egg property] (objects NAME ...)
395
396Specifies that the components of type {{c-object}} should be linked
397to this component and that the object components are dependencies.
398
399
400==== destination
401
402 [egg property] (destination NAME)
403
404Specifies an alternative installation destination for the
405built component and only applies
406to components of type {{data}}, {{c-include}} and {{scheme-include}}.
407This property should only be used in extreme
408cases, as it is recommended to use the default installation
409locations, which are:
410
411* for C include files: {{<PREFIX>/include/chicken/}}
412
413* for Scheme include files: {{<PREFIX>/share/chicken/}}
414
415* for data files: {{<PREFIX>/share/chicken/}}
416
417==== files
418
419 [egg property] (files NAME ...)
420
421Specifies source files for this component and only applies
422to components of type {{data}}, {{c-include}} and {{scheme-include}}.
423Both files and directories may be given and parent directories
424are created as needed.
425
426==== modules
427
428 [egg property] (modules NAME ...)
429
430Specifies modules that the component (usually an extension) contains.
431{{chicken-install}} will compile and install all import libraries for the given modules.
432If this property is not given, then it is assumed that the extension has a single
433module of the same name as the component.
434
435==== cond-expand
436
437 [egg property] (cond-expand CLAUSE ...)
438
439Similar to the toplevel {{cond-expand}} clause and may appear inside
440component specifications.
441
442==== error
443
444 [egg property] (error STRING ARG ...)
445
446Similar to the toplevel {{error}} form, may appear inside component specifications.
447
448---
449
450Previous: [[Extension tools]]
451
452Next: [[Units and linking model]]